<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#one" data-toggle="tab">编辑抢购场次</a></li>
        </ul>
    </div>
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('market/product_save')}">
                    {:token()}
                    <input type="hidden" name="row[id]" value="{$row.id|htmlentities}">
                    
                    <!-- 基本信息 -->
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">场次时间:</label>
                        <div class="col-xs-12 col-sm-4">
                            <input type="text" class="form-control datetimepicker" name="row[start_time]" value="{$row.start_time|htmlentities}" placeholder="请选择开始时间" data-rule="required">
                        </div>
                        <div class="col-xs-12 col-sm-1 text-center" style="padding-top: 7px;">至</div>
                        <div class="col-xs-12 col-sm-4">
                            <input type="text" class="form-control datetimepicker" name="row[end_time]" value="{$row.end_time|htmlentities}" placeholder="请选择结束时间" data-rule="required">
                        </div>
                    </div>
                    
                    <!-- 在售商品 -->
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">在售商品:</label>
                        <div class="col-xs-12 col-sm-10">
                            <div class="row">
                                <div class="col-xs-12 col-sm-4">
                                    <button type="button" class="btn btn-primary btn-block btn-add-product">添加商品</button>
                                </div>
                            </div>
                            <div class="table-responsive" style="margin-top: 10px;">
                                <table class="table table-striped table-bordered" id="active-product-table">
                                    <thead>
                                        <tr>
                                            <th>商品名称/商品ID</th>
                                            <th>所属商家</th>
                                            <th>抢购数量</th>
                                            <th>抢购价</th>
                                            <th>场次销量</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <!-- 在售商品数据将通过JavaScript动态加载 -->
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 历史商品 -->
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">历史商品:</label>
                        <div class="col-xs-12 col-sm-10">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered" id="history-product-table">
                                    <thead>
                                        <tr>
                                            <th>商品名称/商品ID</th>
                                            <th>所属商家</th>
                                            <th>总库存</th>
                                            <th>最低价格</th>
                                            <th>总销量</th>
                                            <th>下架时间</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <!-- 历史商品数据将通过JavaScript动态加载 -->
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 操作按钮 -->
                    <div class="form-group">
                        <div class="col-xs-12 col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-success btn-embossed">保存</button>
                            <a href="{:url('market/index')}" class="btn btn-default">返回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    require(['backend/market'], function(Controller){
        Controller.edit();
    });
</script>